/*
 * 登录的表单验证
 * 返回true，则通过验证进行表单提交操作；返回false，则验证失败，表单不提交
 * 验证失败，需要将错误消息或提示在页面上进行显示
*/
function chkform(){

    let username = document.getElementById("username").value;

    let userpass = document.getElementById("userpass").value;

    if(username.length>=2 && userpass.length>=6){
        return true;
    }

    if(username.length<2){
        document.getElementById("nameerr").innerHTML = "用户名的长度必须大于等于2";
    } else {
        document.getElementById("nameerr").innerHTML = "";
    }

    if(userpass.length<6){
        document.getElementById("passerr").innerHTML = "用户密码的长度必须大于等于6";
    } else {
        document.getElementById("passerr").innerHTML = "";
    }

    return false;
}